package com.hh.front.controller;

import com.hh.common.request.EditSocializeInfoRequest;
import com.hh.common.response.CommonResult;
import com.hh.common.response.SocializeInfoResponse;
import com.hh.service.service.socialize.UserSocializeInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController()
@RequestMapping("api/front/socialize")
public class SocializeController {

    @Autowired
    private UserSocializeInfoService userSocializeInfoService;

    /**
     * 获取社交信息
     * @return
     */
    @RequestMapping(value = "/getSocializeInfo", method = RequestMethod.GET)
    public CommonResult<SocializeInfoResponse> getSocializeInfo(){
        SocializeInfoResponse userSocializeInfo = userSocializeInfoService.getSocializeInfo();
        return CommonResult.success(userSocializeInfo);
    }

    /**
     * 修改社交信息
     * @return
     */
    @RequestMapping(value = "/editInfo", method = RequestMethod.POST)
    public CommonResult<Boolean> editInfo(@RequestBody @Validated EditSocializeInfoRequest request){
        return CommonResult.success(userSocializeInfoService.editInfo(request));
    }

    /**
     * 点赞
     * @return
     */
    @RequestMapping(value = "/giveLike", method = RequestMethod.GET)
    public CommonResult<Boolean> giveLike(){
        return CommonResult.success(userSocializeInfoService.giveLike());
    }


}
